home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1990-04-12 | 2.7 KB | 58 lines |
- 100 REM TRIGONOMETRIC FUNCTIONS
- 105 WIDTH 80
- 110 REM IBM BASIC
- 120 PI=3.14159:RAD=57.2958
- 130 DEF FNHYP(X,Y)=SQR(X^2+Y^2): REM FIND HYPOTENUSE
- 140 DEF FNHX(H,Y)=SQR(H^2-Y^2): REM FIND SIDE X,HORIZONTAL
- 150 DEF FNVY(H,X)=SQR(H^2-X^2): REM FIND SIDE Y,VERTICAL
- 160 DEF FNANGL(A)=90-A: REM FIND ANGLE A OR B
- 170 DEF FNX(H,A)=H*COS(A*(PI/180)): REM FIND SIDE X BY H & A
- 180 DEF FNY(H,A)=H*SIN(A*(PI/180)): REM FIND SIDE Y BY H & A
- 190 DEF FNB(X,Y)=(ATN(X/Y))*(180/PI): REM FIND A OR B BY X & Y
- 200 GOTO 250
- 210 PRINT STRING$(80,45):RETURN
- 220 CLS:FOR X=1 TO 10:PRINT:NEXT X:RETURN
- 230 PRINT:INPUT "Press >RETURN< (Q to quit) ",R$:IF R$="Q" THEN 240 ELSE RETURN
- 240 GOSUB 220:GOSUB 210:PRINT TAB(33)"End.":GOSUB 210:RUN"FILES."
- 250 GOSUB 220:PRINT"Menu:":GOSUB 210:PRINT"Ratios for right triangles:":GOSUB 210
- 260 PRINT 1,"Find hypotenuse":PRINT 2,"Find horizontal side (X)"
- 270 PRINT 3,"Find vertical side (Y)":PRINT 4,"Find angles A and B"
- 280 PRINT 5,"Find two sides (X & Y) by hypotenuse & angle"
- 290 PRINT 6,"Find angles A and B by X and Y":GOSUB 210
- 300 PRINT 7,"Exit program":GOSUB 210
- 310 INPUT "Which? ",WHICH:GOSUB 220
- 320 ON WHICH GOTO 330,380,430,480,520,600,240
- 330 PRINT"Find the length of the hypotenuse of a right triangle":GOSUB 210
- 340 INPUT "Enter the horizontal length (X) ",X
- 350 INPUT "Enter the vertical length (Y) ",Y
- 360 X=FNHYP(X,Y):GOSUB 210
- 370 PRINT"The length of the hypotenuse is ";X:GOSUB 230:GOTO 250
- 380 PRINT"Find the length of the horizontal side (X) of a right triangle":GOSUB 210
- 390 INPUT "Enter the vertical length (Y) ",Y
- 400 INPUT "Enter the diagonal length (hypotenuse)",H
- 410 X=FNHX(H,Y):GOSUB 210
- 420 PRINT"The horizontal length is ";X:GOSUB 230:GOTO 250
- 430 PRINT"Find the length of the vertical side (Y) of a right triangle":GOSUB 210
- 440 INPUT "Enter the horizontal length (X) ",X
- 450 INPUT "Enter the diagonal length (hypotenuse)",H
- 460 XX=FNVY(H,X):GOSUB 210
- 470 PRINT"The vertical length is ";XX:GOSUB 230:GOTO 250
- 480 PRINT"Find the angle opposite side X or Y in a right triangle":GOSUB 210
- 490 INPUT "Enter degrees of one angle ",A
- 500 X=FNANGL(A):GOSUB 210
- 510 PRINT"The other angle is ";X;" degrees":GOSUB 230:GOTO 250
- 520 PRINT"Find the two other sides by hypotenuse and the angle"
- 530 PRINT"between the hypotenuse and the horizontal side":GOSUB 210
- 540 INPUT "Enter length of hypotenuse ",H
- 550 INPUT "Enter the degrees of the angle ",A
- 560 X=FNX(H,A):GOSUB 210
- 570 XX=FNY(H,A)
- 580 PRINT"The horizontal length is ";X
- 590 PRINT"The vertical side is ";XX:GOSUB 230:GOTO 250
- 600 PRINT"Find the degrees of two angles by sides X and Y":GOSUB 210
- 610 INPUT "Enter horizontal side (X) ",X
- 620 INPUT "Enter vertical side (Y) ",Y
- 630 XX=FNB(X,Y):GOSUB 210
- 640 PRINT"Angle A (opposite X) is ";XX;" degrees":BB=90-XX
- 650 PRINT"Angle B (opposite Y) is ";BB;" degrees":GOSUB 230:GOTO 250
-